


    $(document).ready(function () {
		
       $("select[id='dep_year']").val("2020");
	   
       $.ajax({
           url: "../../web/web_report/res_partner", type: "POST", data: {LIMIT:'0'},success: function (result) {                  
              
               $("select[id='dep_data']").empty();      //清空  
               var modelList = eval('(' + result + ')');
               if (modelList && modelList.length != 0) {
                   var option = "<option value='0'>全部机构</option>";
                   $("select[id='dep_data']").append(option);
                   for (var i = 0; i < modelList.length; i++) {
                       var option = "<option value=\"" + modelList[i].id+ "\"";
                      
                       option += ">" + modelList[i].name + "</option>";   
                       $("select[id='dep_data']").append(option);
                   }
               }  
             }
         });
  

        $("#button1").click(function () {
            //var date_start = $('#date_start1').val();
            var dep_year = $('#dep_year option:selected').val();
            var dep_data = $("#dep_data option:selected").val();

            $.ajax({
                url: "../../web/web_report", type: "POST", data: { LIMIT: 0, N: 0, dep_year: dep_year, dep_data: dep_data}, success: function (result) {
                    result = unescape(result.replace(/\\u/g, '%u'));
                    var modelList = eval('(' + result + ')');
///报表数据代码
option = {
    title : {
        text: '',
        subtext: '如图:'
    },
    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['计划收款','实际收款','计划支出','实际支出']
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            magicType : {show: true, type: ['line', 'bar']},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    calculable : true,
    xAxis : [
        {
            type : 'category',
            data : modelList[0].fhcategory
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        {
            name:'计划收款',
            type:'bar',
            data:modelList[0].fhseries1,
            markPoint : {
                data : [
                ]
            },
            markLine : {
                data : [
                    
                ]
            }
        },
        {
            name:'实际收款',
            type:'bar',
            data:modelList[0].fhseries2,
            markPoint : {
                data : [
                ]
            },
            markLine : {
                data : [
                    
                ]
            }
        }
		,
        {
            name:'计划支出',
            type:'bar',
            data:modelList[0].fhseries3,
            markPoint : {
                data : [
                ]
            },
            markLine : {
                data : [
                    
                ]
            }
        }
		,
        {
            name:'实际支出',
            type:'bar',
            data:modelList[0].fhseries4,
            markPoint : {
                data : [
                ]
            },
            markLine : {
                data : [
                    
                ]
            }
        }
    ]
};
           if (option && typeof option === "object") {
               myChart.setOption(option, true);
           }



		

                }
				
            });
     
         });
      $("#button1").click();

    });
